import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/Home',
    name: 'home',
    component: () => import('@/views/Home.vue'), // 建议进行路由懒加载，优化访问性能
    children: [
      {
        path: 'DemoPagesOne',
        name: 'DemoPagesOne',
        component: () => import('@/views/DemoPagesOne.vue')
      },
      {
        path: 'DemoPagesTwo',
        name: 'DemoPagesTwo',
        component: () => import('@/views/DemoPagesTwo.vue')
      },
      {
        path: '/Home',
        redirect: ()=>{ 
          return '/Home/DemoPagesOne'
        }
      }
    ]
  },
  {
    path: '/',
    redirect: () => {
      return '/Home'
    }
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router